package com.study.designPattern.singleton;

/**
 * @author HBZ
 * @description
 * @date 2021/5/14 19:40
 */
public class InnerClassPattern {
        private InnerClassPattern(){
            System.out.println("父类构造方法");
        }

        private static class SingleTonHoler{
            private static InnerClassPattern INSTANCE = new InnerClassPattern();
        }

        public static InnerClassPattern getInstance(){
            return SingleTonHoler.INSTANCE;
        }

    public static void main(String[] args) {
        InnerClassPattern p1=InnerClassPattern.getInstance();
        InnerClassPattern p2=InnerClassPattern.getInstance();
        System.out.println(p1==p2);
    }
}
